

import SwiftUI
import NetworkExtension

@main
struct Encrypto_VPNApp: App {
    @UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
    @StateObject private var timerViewModel = TimerViewModel()
    @StateObject private var speedViewModel = SpeedViewModel()
    @Environment(\.scenePhase) private var scenePhase
    @State private var isVPNConnected = false

    var body: some Scene {
        WindowGroup {
            
            SplashView(vpnStatus: $isVPNConnected)
                .environmentObject(timerViewModel)
                .environmentObject(speedViewModel)
            
        }.onChange(of: scenePhase) { newPhase in
            if newPhase == .active {
                checkVPNStatus()
            }
        }
    }
    private func checkVPNStatus() {
        isVPNConnected = true
    }
}
